#ifndef COMMAND_H
#define COMMAND_H

#include "cache.h"
#include <stddef.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>

// 命令分发主入口
// 输入：命令字符串、输出缓冲区、输出缓冲区大小、缓存指针
// 返回：0成功，-1失败
int command_dispatch(const char* cmd_str, char* response, size_t resp_size, Cache* cache);

// SET命令
int command_set(char** argv, int argc, char* response, size_t resp_size, Cache* cache);

// GET命令
int command_get(char** argv, int argc, char* response, size_t resp_size, Cache* cache);

// DEL命令
int command_del(char** argv, int argc, char* response, size_t resp_size, Cache* cache);

// EXPIRE命令
int command_expire(char** argv, int argc, char* response, size_t resp_size, Cache* cache);

// TTL命令
int command_ttl(char** argv, int argc, char* response, size_t resp_size, Cache* cache);

#endif
